package com.vhall.component.entity.notice.vo;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.vhall.component.entity.notice.NoticesEntity;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

/**
 * @author xianglei
 * @date 2021/5/31 18:24
 */
@Data
@NoArgsConstructor
public class NoticeListRspVo implements Serializable {
    private static final long serialVersionUID = 7146862715963926327L;

    private Integer total;

    @JsonProperty("last_page")
    private Integer totalPage;

    @JsonProperty("page")
    private Integer currPage;

    private List<NoticesEntity> list;

    public NoticeListRspVo(Page<NoticesEntity> page) {
        this.totalPage = (int) page.getPages();
        this.currPage = (int) page.getCurrent();
        this.total = (int) page.getTotal();
        this.list = page.getRecords();
    }
}
